using System;

namespace NMollom {
    /// <summary>
    /// All Mollom statistics grouped in one place.
    /// </summary>
    [Serializable]
    public struct Statistics {
        private readonly int today_accepted;
        private readonly int today_rejected;
        private readonly int total_accepted;
        private readonly int total_days;
        private readonly int total_rejected;
        private readonly int yesterday_accepted;
        private readonly int yesterday_rejected;

        public Statistics(int totalDays, int totalAccepted, int totalRejected, int yesterdayAccepted,
                          int yesterdayRejected, int todayAccepted, int todayRejected) {
            total_days = totalDays;
            total_accepted = totalAccepted;
            total_rejected = totalRejected;
            yesterday_accepted = yesterdayAccepted;
            yesterday_rejected = yesterdayRejected;
            today_accepted = todayAccepted;
            today_rejected = todayRejected;
        }

        public int TotalDays {
            get { return total_days; }
        }

        public int TotalAccepted {
            get { return total_accepted; }
        }

        public int TotalRejected {
            get { return total_rejected; }
        }

        public int YesterdayAccepted {
            get { return yesterday_accepted; }
        }

        public int YesterdayRejected {
            get { return yesterday_rejected; }
        }

        public int TodayAccepted {
            get { return today_accepted; }
        }

        public int TodayRejected {
            get { return today_rejected; }
        }

        public int this[StatisticType type] {
            get {
                switch (type) {
                    case StatisticType.TotalDays:
                        return total_days;
                    case StatisticType.TotalRejected:
                        return total_rejected;
                    case StatisticType.TotalAccepted:
                        return total_accepted;
                    case StatisticType.YesterdayRejected:
                        return yesterday_rejected;
                    case StatisticType.YesterdayAccepted:
                        return yesterday_accepted;
                    case StatisticType.TodayRejected:
                        return today_rejected;
                    case StatisticType.TodayAccepted:
                        return today_accepted;
                }

                return 0;
            }
        }
    }
}